package com.xoa.controller.performance.leaderAssessment;

import com.xoa.model.performance.ScoreFlowUsers;
import com.xoa.model.performance.leaderAssessment.ScoreFlowUsersLeader;
import com.xoa.service.performance.ScoreFlowUserService;
import com.xoa.service.performance.leaderAssessment.ScoreFlowUserLeaderService;
import com.xoa.util.common.wrapper.BaseWrapper;
import com.xoa.util.page.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("scoreFlowUserLeader")
public class ScoreFlowUserLeaderController {

    @Autowired
    private ScoreFlowUserLeaderService scoreFlowUserService;

    @RequestMapping("userList")
    public String userListPage() {
        return "app/hr/leaderAssessment/scoreFlowUser/leaderUserList";
    }

    @RequestMapping("setting")
    public String setting() {
        return "app/hr/leaderAssessment/scoreFlowUser/leaderSetting";
    }

    @RequestMapping("settingDetail")
    public String settingDetail() {
        return "app/hr/leaderAssessment/scoreFlowUser/leaderSettingDetail";
    }

    @RequestMapping("scoreDetail")
    public String scoreDetail() {
        return "app/hr/leaderAssessment/scoreFlowUser/leaderScoreDetail";
    }

    @RequestMapping("selectUser")
    public String selectUsers() {
        return "app/hr/leaderAssessment/scoreFlowUser/leaderSelectUser";
    }

    @RequestMapping("selectDept")
    public String selectDept() {
        return "app/hr/leaderAssessment/scoreFlowUser/leaderelectDept";
    }

    @ResponseBody
    @RequestMapping("selFlowUsers")
    public BaseWrapper selFlowUsers(HttpServletRequest request, HttpServletResponse response,PageParams pageParams, String userId,Integer flowId,Boolean export) {
        return scoreFlowUserService.selFlowUsers(request,response,pageParams,userId,flowId,export);
    }

    @ResponseBody
    @RequestMapping("delete")
    public BaseWrapper delete(String ids){
        return scoreFlowUserService.delete(ids);
    }

    @ResponseBody
    @RequestMapping("selAssessors")
    public BaseWrapper selAssessors(String userId,Integer scoreFlowId){
        return scoreFlowUserService.selAssessors(userId, scoreFlowId);
    }

    @ResponseBody
    @RequestMapping("setAssessors")
    public BaseWrapper setAssessors(HttpServletRequest request, ScoreFlowUsersLeader scoreFlowUsers, String insertType, String userIds) {
        return scoreFlowUserService.setAssessors(request ,scoreFlowUsers, insertType, userIds);
    }

    @ResponseBody
    @RequestMapping("selByAssessor")
    public BaseWrapper selByAssessor(HttpServletRequest request,Integer scoreFlowId){
        return scoreFlowUserService.selByAssessor(request, scoreFlowId);
    }

    @ResponseBody
    @RequestMapping("selUserScoreDetail")
    public BaseWrapper selUserScoreDetail(Integer flowId,String userId){
        return scoreFlowUserService.selUserScoreDetail(flowId, userId);
    }

    @ResponseBody
    @RequestMapping("selUserScoreCount")
    public BaseWrapper selUserScoreCount(Integer flowId,String userId){
        return scoreFlowUserService.selUserScoreCount(flowId, userId);
    }

    @ResponseBody
    @RequestMapping("getAllData")
    public BaseWrapper getAllData(Integer flowId){
        return scoreFlowUserService.getAllData(flowId);
    }
}
